package com.zzx.test.io;

import org.junit.Test;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;

/**
 * @ClassName: HomeWork1
 * @Description: 练习1
 * @Author zhouzhixin
 * @Date 2021/12/2
 * @Version 1.0
 */
public class HomeWork2 {

    @Test
    public void test1() {
        String filePath1 = "e:\\news4.txt";
        try (BufferedReader bufferedReader = new BufferedReader(new FileReader(filePath1))) {
            String line;
            int num = 1;
            while ((line = bufferedReader.readLine()) != null) {
                System.out.println(num + ". " + line);
                num++;
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
